<#assign dialogId = nowTimestamp.getTime()/>
<div class="table-container" style="width: 22%;">
    <div class="table-img add-table">
        <a href="javascript: void(0);" id="add-table-button">
        <i class="fa fa-plus"></i></a>
    </div>
</div>
<div id="${dialogId}" title="${uiLabelMap.RestaurantCreateNewTable}">
  <p id="errorMessage${dialogId}" class="error-message"></p>
  <form name="createNewTable" action="<@ofbizUrl>createNewTable</@ofbizUrl>" method="post">
    <table class="basic-table" cellspacing="0">
          <tbody>
          <tr>
            <td class="label">${uiLabelMap.RestaurantTableName}</td>
            <td><input type="text" name="tableName" id="name" value="" class="text ui-widget-content ui-corner-all"></td>
          </tr>
        </tbody>
    </table>
  </form>
</div>
<script>
    function createNewTable () {
        submitDialogForm("${dialogId}", document.createNewTable)
        return false;
    }
    dialog${dialogId} = $( "#${dialogId}" ).dialog({
      autoOpen: false,
      height: 200,
      width: 500,
      modal: true,
      buttons: {
        "${StringUtil.wrapString(uiLabelMap.RestaurantSave)}": createNewTable,
        "${StringUtil.wrapString(uiLabelMap.RestaurantCancel)}": function() {
          dialog${dialogId}.dialog( "close" );
          $("#errorMessage${dialogId}").html("");
        }
      },
      close: function() {
        document.createNewTable.reset();
      }
    });
    
    $("#add-table-button").button().on( "click", function() {
        dialog${dialogId}.dialog( "open" );
    });
  </script>